home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / ste / autoexec.lzh / SOURCE / MXALLOC.S < prev    next >
Text File  |  1991-08-05  |  1KB  |  41 lines

  1. *    MXALLOC is written by Klaus Pedersen (micro@imada.dk), and
  2. *    distributed, together with "NT_COMP" - the NoiseTracker Compiler
  3. *    for Atari [MEGA] ST, STe and TT computers.
  4. *
  5.  
  6. MXALLOC         EQU $44
  7. MALLOC          EQU $48
  8. GemDos          EQU 1
  9.  
  10.                 GLOBL Mxalloc
  11.                 
  12. ; void *Mxalloc(long amount, int type);
  13. ;   type : 
  14. ;     0 - ST ram needed (DMA sound/ACSI/VIDEO)
  15. ;     1 - TT ram needed...
  16. ;     2 - ST ram if possible else TT...
  17. ;     3 - TT ram if possible else ST (SCSI/LAN)
  18.  
  19. ; TC passes :
  20. ;   'amount' in D0.l
  21. ;   'type'   in D1.w
  22.  
  23.                 TEXT
  24.  
  25. Mxalloc:        move.w   D1,-(SP)
  26.                 move.l   D0,-(SP)
  27.                 move.w   #MXALLOC,-(SP)
  28.                 trap     #GemDos
  29.                 moveq    #-$20,D1     ; Test for "Unknown Gemdos function"
  30.                 cmp.l    D1,D0
  31.                 bne.b    return
  32.  
  33.                 move.w   #MALLOC,(SP) ; If no Mxalloc then use Malloc
  34.                 trap     #GemDos
  35.  
  36. return:         addq.l   #8,SP        ; Tidy stack
  37.                 movea.l  D0,A0        ; Pointers in Address regs.
  38.                 rts
  39.  
  40.                 END
  41.